﻿@using System.Domain.Entities
@{
    Layout = null;
    List<Menu> list = ViewBag.ButtonList ?? new List<Menu>();
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>产品管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="~/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="~/layuiadmin/style/admin.css" media="all">
    <link href="~/css/fbw.css" rel="stylesheet" />
</head>
<body>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header fbw-card-header">
                        <div class="layui-form">
                            <div class="layui-form-item">
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body">
                        <table class="layui-hide" id="test-table-toolbar" lay-filter="test-table-toolbar"></table>
                        <script type="text/html" id="article-table-toolbar">
                            <div class="layui-btn-container">
                                @Html.SetPermissionButton(list, "add", "layui-btn-sm", LayHtmlHelper.GetEvent("add"))
                            </div>
                        </script>
                        <script type="text/html" id="article-table-toolbar-toolbarDemo">
                            @Html.SetPermissionButton(list, "edit", "layui-btn-sm", LayHtmlHelper.GetEvent("edit"))
                            @Html.SetPermissionButton(list, "del", "layui-btn-danger layui-btn-sm", LayHtmlHelper.GetEvent("del"))
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="~/layuiadmin/layui/layui.js"></script>
    <script src="~/js/Tools.js"></script>
    <script>
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table', 'form'], function () {
            var User = layui.User
                , table = layui.table
                , form = layui.form
                , $ = layui.$;

            var wd = ['600px', '600px'];
            var winheight = $(window).height();
            if (winheight < 600) {
                wd = ['100%', '100%'];
            }
            table.render({
                id: 'test-table-toolbar'
                , elem: '#test-table-toolbar'
                , url: '/Product/GetProductList'
                , title: '产品列表'
                , method: 'POST'
                , cols: [[{
                    field: 'productName', title: '产品名称', width: 150
                }, {
                    field: 'productCode', title: '产品编号', width: 150
                }
                    , { field: 'createUserName', title: '创建人', width: 150 }
                    , {
                    field: 'createTime', title: '创建时间', width: 200
                }
                ]]
                , page: true
                , limit: 15
                , limits: [15, 30, 45, 60, 75, 100, 200],
                height: 'full-35',
                lineStyle: 'height: 65px;', // 定义表格的多行样式
                // , parseData: function (res) {
                //     res.data = JSON.parse(res.data);
                //     return res;
                // }
            });
            //重新加载数据
            function reloadData() {
                var name = $("#name").val();
                var role = $("#role").val();
                //查询条件
                var sWhere = {};
                sWhere.name = name;
                sWhere.role = role;
                //重新加载
                var option = { where: sWhere, page: { curr: 1 } };
                table.reload("test-table-toolbar", option);
            }
            //搜索
            $(".btnSearch").click(function () {
                reloadData();
            })
        });
    </script>
</body>
</html>